﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using QianBuo.Lottery.Web.Models;
using System.Web.Mvc;

using System.ComponentModel.DataAnnotations;
using Code.Models;

namespace QianBuo.Lottery.Web.Areas.Manage.Models.Lottery
{

    [Serializable]
    public class WinMoneySetModel
    {
        public Code.Models.LotteryTypeType? LotteryID { get; set; }
        public ModelNameValue<Code.Models.LotteryTypeType, string> Lotterys { get; set; }
        public Code.BLL.PlayTypeOptionManage.WinMoneyOptionSetItem[] Options { get; set; }
        public ModelNameValue<string, object> ViewData { get; set; }
    }

    [Serializable]
    public class LotterySetModel
    {
        [Required]
        public LotteryModel[] Lotterys { get; set; }

        [Serializable]
        public class LotteryModel
        {
            [Required(ErrorMessage = "*")]
            public int ID { get; set; }

            public string Name { get; set; }

            public bool State { get; set; }

            [Required(ErrorMessage = "*"), Range(0, 255, ErrorMessage = "*")]
            [DataType(DataType.Text, ErrorMessage = "*")]
            public short AutoAddIssue { get; set; }

            [Required(ErrorMessage = "*")]
            [Range(0, (60 * 60 * 24) - 1)]
            [DataType(DataType.Text, ErrorMessage = "*")]
            public int ForwardEnd { get; set; }

            [Required(ErrorMessage = "*")]
            [Range(0, (60 * 60 * 24) - 1)]
            [DataType(DataType.Text, ErrorMessage = "*")]
            public int OpenWinOverTime { get; set; }

            [Required(ErrorMessage = "*")]
            [Range(0, (60 * 60 * 24) - 1)]
            [DataType(DataType.Text, ErrorMessage = "*")]
            public int OpenWinDelayTime { get; set; }

            [DataType(DataType.Text,ErrorMessage="*")]
            public int? Sort { get; set; }
        }
    }

    [Serializable]
    public class PlayTypeSetModel
    {
        [Required]
        public Code.Models.LotteryType Lottery { get; set; }
        [Required]
        public ModelNameValue<Code.Models.LotteryType, string> Lotterys { get; set; }
        [Required]
        public PlayTypeModel[] PlayTypes { get; set; }

        [Serializable]
        public class PlayTypeModel
        {
            [Required]
            public int ID { get; set; }
            public string Name { get; set; }
            [Required(ErrorMessage = "*")]
            public bool State { get; set; }
            [Required(ErrorMessage = "*")]
            [DataType(DataType.Text, ErrorMessage = "*")]
            public int? MaxBuyMultiple { get; set; }
            [Required(ErrorMessage = "*")]
            [DataType(DataType.Text, ErrorMessage = "*")]
            public int? MaxBuyCount { get; set; }
            [DataType(DataType.Text, ErrorMessage = "*")]
            public int? Sort { get; set; }
            [Required(ErrorMessage = "*")]
            public BuyNumber[] BuyNumbers { get; set; }
            public string RestrictiveNumber { get; set; }
            [Required(ErrorMessage = "*")]
            public int BackMoneyTypeID { get; set; }
        }
        [Serializable]
        public class BuyNumber
        {

            [ Range(0, int.MaxValue, ErrorMessage = ">0")]
            public int? Len { get; set; }
        }
    }

    [Serializable]
    public class KaiJiamgModel
    {
        public IList<SelectListItem> Lotterys { get; set; }
        public IList<SelectListItem> Issues { get; set; }
        [Required(ErrorMessage="*")]
        public long? IssueID { get; set; }
        [Required(ErrorMessage="*")]
        public LotteryType? Lottery { get; set; }
        [Required(ErrorMessage="*")]
        [RegularExpression(@"[\d,]{3,}",ErrorMessage="*")]
        public string OpenCode { get; set; }

        public IEnumerable<Code.BLL.SchemeManage.SchemeItemModel> Scheme { get; set; }
    }

    [Serializable]
    public class ChuPiaoModel
    {
        public IList<SelectListItem> Lotterys { get; set; }
        public IList<SelectListItem> Issues { get; set; }
        [Required(ErrorMessage = "*")]
        public long? IssueID { get; set; }
        [Required(ErrorMessage = "*")]
        public LotteryType? Lottery { get; set; }

        public IEnumerable<Code.BLL.SchemeManage.SchemeItemModel> Scheme { get; set; }
    }
    [Serializable]
    public class BackMoneyTypeModel
    {
        public BackMoneyTypeItem[] Types { get; set; }
    }

    [Serializable]
    public class BackMoneyTypeItem
    {
        public int ID { get; set; }
        public string Name { get; set; }
    }

    [Serializable]
    public class BackMoneyTypeEditModel
    {
        public int? ID { get; set; }
        [Required(ErrorMessage = "*")]
        public string Name { get; set; }
        public bool N { get; set; }
    }

    [Serializable]
    public class ResetWinMoneyModel
    {
        public List<SelectListItem> WinModels { get; set; }
        public List<SelectListItem> Lotters { get; set; }
        public LotteryType? Lottery { get; set; }
        public int? WinModelID { get; set; }

        public double? Ratio { get; set; }
        public double? WinMoney { get; set; }
    }
    [Serializable]
    public class RankModel
    {
        public RankItem[] Types { get; set; }
    }
    [Serializable]
    public class RankItem
    {
        public int id { get; set; }
        public int ran { get; set; }
        public int exper { get; set; }
        public double resetMoneyToMy { get; set; }
        public double resetMoneyToUp { get; set; }
    }

    [Serializable]
    public class RanEditModel
    {
        public int? ID { get; set; }
        [Required(ErrorMessage = "*")]
        public int Ranks { get; set; }
        public int Exper { get; set; }
        public double ResetMoneyToMy { get; set; }
        public double ResetMoneyToUp { get; set; }
        public bool N { get; set; }
    }
   



}